unit AM_Modulos_Becados;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, F_AM, StdCtrls, JvExControls, JvSpeedButton, ExtCtrls,
  JvDBLookup, JvExStdCtrls, JvEdit, JvValidateEdit, DB, ZAbstractRODataset,
  ZAbstractDataset, ZDataset, cxControls, cxContainer, cxEdit, cxTextEdit,
  cxMaskEdit, cxDropDownEdit, cxCalendar, ComCtrls, JvExComCtrls,
  JvDateTimePicker, JvDBDateTimePicker, Mask, JvExMask, JvToolEdit;

type
  TF_AgregarModuloUsuario = class(TF_AltaModificacion)
    Label_Nombre: TLabel;
    Edit_Nombre: TEdit;
    L_Usuario: TLabel;
    JvDBLC_Producto: TJvDBLookupCombo;
    Edit_Monto: TJvValidateEdit;
    Label_Monto: TLabel;
    ZQuery_Add_Monto: TZQuery;
    DS_Users: TDataSource;
    ZROQ_Users: TZReadOnlyQuery;
    Label1: TLabel;
    DTP_Fecha: TJvDateEdit;
  private
    { Private declarations }
  public
    { Public declarations }
    constructor Create (var owner: TComponent); overload;

    procedure Agregar; override;
    function ValidarCampos: boolean; override;
  end;


implementation

uses DM_Persistencia;

{$R *.dfm}

constructor TF_AgregarModuloUsuario.Create (var owner: TComponent);
begin
  inherited Create(owner);
end;

function TF_AgregarModuloUsuario.ValidarCampos: boolean;
begin
  if ((Edit_Nombre.Text <> '') and (JvDBLC_Producto.KeyValue>0) and (Edit_Monto.Value>0)) then
    Result:= True
end;

procedure TF_AgregarModuloUsuario.Agregar;
begin
  with ZQuery_Add_Monto do
      begin
        Close;
          ParamByName('FK_ID_USUARIO').AsInteger:= JvDBLC_Producto.KeyValue;
          ParamByName('TITULO_MODULO').AsString:= Edit_Nombre.Text;
          ParamByName('FECHA').AsDate:= DTP_Fecha.Date;
          ParamByName('PRECIO').AsFloat:= Edit_Monto.Value;
        ExecSQL;
      end
end;

end.
